import { defineStore } from "pinia";
import { IChatListItem } from '@api/chat'

export const useChatStore = defineStore("chatId", {
  state: (): {
    menuId: number;
    isMenuRightOpen: boolean,
    menuList: IChatListItem[]
  } => {
    return {
      menuId: 0,
      isMenuRightOpen: false,
      menuList: []
    };
  },
  actions: {
    toggleMenuRight() {
      this.isMenuRightOpen = !this.isMenuRightOpen;
    },
  },
  persist: {
    enabled: true,
    strategies: [
      {
        storage: localStorage, //默认是session
        paths: ["menuId", "isMenuRightOpen", "menuList"],
      },
    ],
  },
});
